<?php
require_once "../Common/database.php";
require_once "../Common/values.php";
require_once "theme.php";

if($publiclock=='true')
{
echo '<center><H1>SYSTEM lOCKED!! '.$lockedreason.'</CENTER></H1>';
exit;
}
$month=date("m", time()) ;
$day=date("d", time())+1;

switch ($month)
{
    case('01');
    if ($day>=31)
    {
    $day=$day-31;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('02');
    if ($day>=28)
    {
    $day=$day-31;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('03');
    if ($day>=31)
    {
    $day=$day-31;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('04');
    if ($day>=31)
    {
    $day=$day-30;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('05');
    if ($day>=31)
    {
    $day=$day-31;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('06');
    if ($day>=30)
    {
    $day=$day-30;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('07');
    if ($day>=31)
    {
    $day=$day-31;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('08');
    if ($day>=31)
    {
    $day=$day-31;
    $month=$month+1;
    $month='0'.$month;
    }
    break;

    case('09');
    if ($day>=30)
    {
    $day=$day-31;
    $month=$month+1;

    }
    break;

    case('10');
    if ($day>=31)
    {
    $day=$day-31;
    $month=$month+1;
    
    }
    break;


    case('11');
    if ($day>=30)
    {
    $day=$day-31;
    $month=$month+1;
    
    }
    break;

    case('12');
    if ($day>=31)
    {
    $day=$day-31;
    $month='01';

    }
    break;

}
if($day<10)
{
$day='0'.$day;

}

$result = mysql_query("SELECT * FROM tblbranches WHERE BranchName='$_POST[branch]'");
while($row = mysql_fetch_array($result))
{
$_POST[branch]=$row[BranchNumber];
}



echo '<h3>Password Reset form</h3>';

if ($ldap=='true')
{
echo '<table><tr><form method="Post" Action="ldapsearch.php?f=password"><td class="noborder">Last Name : <input type=text name=lastname></td><td class="noborder"><INPUT type="image" src="../img/go.gif"></td></tr></form>';
}
echo '<form method="Post" Action=../helpdesk/publicinsertpassword.php name="jobForm">';
echo '<table width=100%><tr>';
echo '<td>Log : '.'<INPUT type="hidden" name="log">';echo 'New'.'</td>';
echo '<td>Operator :<INPUT type="hidden" name="operator" value="Public"> Public<p> </td>' ;
echo '<td>Date : <INPUT type="hidden" name="date" value='.$date.'>'.$date.'';
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time : <INPUT type="hidden" name="time" value='.$time.'>'.$time.'</td>';

echo '<tr><td>Requestor : <p><INPUT TYPE="Text" Size="30" name="requestor" value="'.$_POST['requestor'].'"></td>';
echo '<td>Email updates to: <br> <Input Type="text" name="mailupdates" value="'.$_POST[mail].'" size="30">';
echo '<tr><td> Branch No : <p> <Select name="branch"><option>'.$_POST['branch'].'</option>';
genBranches();
echo '</select></td><td>Department:<p><INPUT type="text" name="department" value="'.$_POST['department'].'"></td>  <td> Phone: <p><INPUT type="text" name="phone" value="'.$_POST['phone'].'"></td></tr><tr><td>Due date : <p><INPUT type="text" name="dueday" size="2" value="'.$day.'">/<INPUT type="text" name="duemonth" size="2" value="'.$month.'">/<INPUT type="text"  size="2"name="dueyear" value=09></td>';
echo ' <td>Proirty:<p> <SELECT name="proirty" Disabled>
    <option>Medium</option></SELECT></td>';
echo '<td>Status :<p> <SELECT name="status" Disabled>
    <option>Pending</option></SELECT> </TD></TR>';
echo '<tr><td colspan=4>Subject: <input type="text" size="30" name="subject" value="Password Reset Request" readonly ></td></tr>';


echo'<tr><td>User ID : <input type="text" name="UserID" value="" size="15" /></td><td>Applcation : <Select name="fran">';

genApplications();
echo '</select></td><td>Dealer Code : <input type="text" name="code" value="" size="15" /></td>';

echo '</table>';



echo '<p><b>If the application does not appear applications box please contact your line / zone manager</b>';

echo '<p><INPUT type="image" src="../img/submit.gif">';


?>

